import request from '@/utils/request'
import { CHECC_API_BASE_DATA } from '@/constants/proxy'
// 门架交通量 每月
// 获取列表
export function requestTraffic(params: any, data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-month/page`,
    method: 'post',
    data: data,
    params,
  })
}

// 保存信息
export function saveTraffic(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-month`,
    method: 'post',
    data,
  })
}

// 删除信息
export function deleteRecordsRequest(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-month`,
    method: 'delete',
    data,
  })
}

// 更新信息
export function updateTraffic(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-month`,
    method: 'PUT',
    data,
  })
}

// 根据Id获取单条数据
export function getRecordRequest(id: string): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-month/${id}`,
    method: 'get',
  })
}

// // 锁定/解锁
// export function culvertLock(data: any): Promise<any> {
//   return request({
//     url: CHECC_API_BASE_DATA + `/bdCulvertIn/lock`,
//     method: 'post',
//     data
//   })
// }

// 门架交通量 每日

// 获取列表
export function requestTrafficDay(params: any, data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-day/page`,
    method: 'post',
    data: data,
    params,
  })
}

// 保存信息
export function saveTrafficDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-day`,
    method: 'post',
    data,
  })
}

// 删除信息
export function delTrafficDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-day`,
    method: 'delete',
    data,
  })
}

// 更新信息
export function updateTrafficDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-day`,
    method: 'PUT',
    data,
  })
}

// 锁定/解锁
export function TrafficLockDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-day/lock`,
    method: 'post',
    data,
  })
}

// 通过id查询数据
export function getTrafficDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-day/${data}`,
    method: 'get',
  })
}

// 收费站交通量 每月

// 获取列表
export function requestStation(params: any, data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-toll-station-month/page`,
    method: 'post',
    data: data,
    params,
  })
}

// 收费站交通量 每日

// 获取列表
export function requestToll(params: any, data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-toll-station-day/page`,
    method: 'post',
    data: data,
    params,
  })
}

// 保存信息
export function saveTollDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-toll-station-day`,
    method: 'post',
    data,
  })
}

// 删除信息
export function delTollDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-toll-station-day`,
    method: 'delete',
    data,
  })
}

// 更新信息
export function updateTollDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-toll-station-day`,
    method: 'PUT',
    data,
  })
}

// 锁定/解锁
export function tollLockDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-toll-station-day/lock`,
    method: 'post',
    data,
  })
}

// 通过id查询数据
export function getTollDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-toll-station-day/${data}`,
    method: 'get',
  })
}

// 拆分交通量

// 获取列表
export function requestVolumeSplit(params: any, data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-volume-split/page`,
    method: 'post',
    data: data,
    params,
  })
}

// 保存信息
export function saveVolumeSplit(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-volume-split`,
    method: 'post',
    data,
  })
}

// 删除信息
export function delVolumeSplit(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-volume-split`,
    method: 'delete',
    data,
  })
}

// 更新信息
export function updateVolumeSplit(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-volume-split`,
    method: 'PUT',
    data,
  })
}

// 锁定/解锁
export function VolumeSplitLockDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-volume-split/lock`,
    method: 'post',
    data,
  })
}

// 通过id查询数据
export function getSplitDay(data: any): Promise<any> {
  return request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-volume-split/${data}`,
    method: 'get',
  })
}

export const lockRecordRequest = (id: string, lock: '0' | '1') =>
  request({
    url: CHECC_API_BASE_DATA + `/bd-traffic-flow-gantry-month/lock`,
    method: 'post',
    data: {
      id,
      lock,
    },
  })
